<%@ page language="java" pageEncoding="UTF-8" %>
<%@ include file="/page/share/taglib.jsp" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <base href="<%=basePath%>">

    <title>普通用户列表</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <link rel="stylesheet" type="text/css" href="<%=basePath%>/css/base.css">

    <script type="text/javascript" src="<%=basePath%>/jslib/jquery.js"></script>
    <script language="JavaScript" type="text/javascript">
        function topage(page) {
            var form = document.getElementById("myform");
            document.getElementById("page")
                    .setAttribute("value",page);
            form.submit();
        }

        function actionEvent(methodname) {
            var form = document.getElementById("myform");
            if (ValidateIsSelect(form.all, form.userNames)) {
                form.action = "Person!personState.action";
                form.method.value = methodname;
                form.submit();
            } else {
                alert("请选择要操作的记录");
            }

        }
        /*
         *全选
         */
        function allselect(allobj, items) {
            var state = allobj.checked;
            if (items.length > 0) {
                for (var i = 0; i < items.length; i++) {
                    if (!items[i].disabled) {
                        items[i].checked = state;
                    }
                }
            } else {
                if (!items.disabled)items.checked = state;
            }
        }

        /*
         *判断是否选择了记录
         */
        function ValidateIsSelect(allobj, items) {
            if (items.length > 0) {
                for (var i = 0; i < items.length; i++) {
                    if (items[i].checked) {
                        return true;
                    }
                }
            } else {
                if (items.checked)return true;
            }
            return false;
        }
    </script>

    <link  type="text/css" rel="stylesheet" href="css/smartmenu.css" >
    <script type="text/javascript" src="<%=basePath%>/jslib/index/jquery-1.3.2.min.js"></script>
    <script type="text/javascript" src="<%=basePath%>/jslib/index/smartmenu-min.js"></script>
    <script type="text/javascript" src="<%=basePath%>/jslib/Menu.js"></script>

</head>

<body style="text-align: center">
<%@ include file="/page/share/menu.jsp" %>
<div id="content">
<form action="Person!userList.action" method="post" id="myform">
    <input type="hidden" name="method" value=""/>
    <input type="hidden" name="page" value="" id="page"/>
    <input type="hidden" name="userName" value="${userName}"/>
    <input type="hidden" name="email" value=""${email}/>
    <input type="hidden" name="phone" value="${phone}"/>
    <input type="hidden" name="startCredit" value="${startCredit}"/>
    <input type="hidden" name="EndCredit" value="${EndCredit}"/>
    <input type="hidden" name="startLevel" value="${startLevel}"/>
    <input type="hidden" name="EndLevel" value="${EndLevel}"/>
    <input type="hidden" name="authority" value="${authority}"/>
    <input type="hidden" name="query" value="${query}"/>
    <table align="center" border="1" cellspacing="0" id="list">
        <thead align="center">
        <tr>
            <td colspan="10" bgcolor="6f8ac4" align="right">
                <%@ include file="/page/share/fenye.jsp" %>
            </td>
        </tr>
        <tr>
            <td>
                &nbsp;
            </td>
            <td>
                账号
            </td>
            <td>
                电话
            </td>
            <td>
                邮箱
            </td>
            <td>
                信誉
            </td>
            <td>
                等级
            </td>
            <td>
                账号状态
            </td>
            <td>
                权限
            </td>
            <td>
                编辑
            </td>

        </tr>

        <s:iterator value="pageView.records" var="person">
            <tr>
                <td>
                    <label>
                        <input type="checkbox" name="userNames" value="${person.userName}"/>
                    </label></td>
                <td>${person.userName}</td>
                <td>${person.phone}</td>
                <td>${person.email}</td>
                <td>${person.credit}</td>
                <td>${person.level}</td>
                <td>
                    <s:if test="#person.enabled">使用中</s:if>
                    <s:if test="!#person.enabled">停用</s:if></td>
                <td>${person.authority}</td>
                <td><a href="Person!loadPerson.action?id=${person.id}">
                    <img src="<%=path%>/img/edit.gif" width="15" height="16" border="0"
                         alt="编辑"/></a></td>
            </tr>

        </s:iterator>
        </thead>
    </table>
    <table id="select">
        <tr>
            <td>
                <label>
                    <input type="checkbox" name="all" onclick="allselect(this,this.form.userNames)">全选&nbsp
                </label>
                <input type="button" value="用户查询" onclick="window.location.href='<%=path%>/page/person/queryUser.jsp'"
                       class="btn">
                <input type="button" name="enabled" onclick="actionEvent('enable')" value="启用账号" class="btn">
                <input type="button" name="disable" onclick="actionEvent('disable')" value="停用账号" class="btn">
                <input name="personManage" type="button" value="显示全部用户" class="btn" onclick="window.location.href='Person!userList.action'"/>
            </td>
        </tr>
    </table>
</form>
</div>
<div id="bottom">
    <ul>
        <li>
            联系我们：
            <a href="mailto:willsonz@qq.com?subject=KTV综合管理系统">willsonz@qq.com</a>
        </li>
    </ul>
    <ul>
        <li>
            ©&nbsp;Made By Cloud Team.
        </li>
    </ul>
</div>
</body>
</html>